package com.iwhalecloud.bss.kite.cucc.client.api.batch;

import com.github.pagehelper.PageInfo;
import com.iwhalecloud.bss.kite.cucc.client.dto.batch.KiteBatchAccept;
import com.iwhalecloud.bss.kite.cucc.client.dto.batch.KiteBatchAcceptDetail;
import com.iwhalecloud.bss.kite.cucc.client.vo.batch.BatchAccepImportFileVO;
import com.iwhalecloud.bss.kite.cucc.client.vo.scene.BusimportDetailVO;

import java.io.InputStream;
import java.util.List;
import java.util.Map;

/**
 * @author : xie.zhengjun
 * @interface : IBatchAcceptService
 * @description : 批量受理服务，包括收入归集集团批量功能
 * @date : 2021/5/26 10:09
 */
public interface IBatchAcceptService {
    /**
     * 导入数据到缓存中
     *
     * @param inputStream
     * @param isXls
     * @param sceneInstId
     * @param fileName
     * @param importType
     * @return
     */
    String importData(InputStream inputStream, boolean isXls, String sceneInstId, String fileName, String importType);

    /**
     * 保存导入数据到表中
     *
     * @param sceneInstId
     * @param custId
     * @return
     */
    String saveImport(String sceneInstId, String custId);

    Long insertBatchAccept(String sceneInstId, List<?> dataList, String fileName, String importType, String rowsNum);

    void insertKiteBatchAccept(String sceneInstId, String fileName, String importNum, String importType,
                               String cartId, Long batchId);

    /**
     * 批量受理录入-文件导入
     * @param inputStream
     * @param isXls
     * @param sceneInstId
     * @param fileName
     * @param importType
     * @return
     */
    String importBatchAcceptData(InputStream inputStream, boolean isXls, String sceneInstId, String fileName,
        String importType, Long batchId);

    /**
     * 批量受理录入-文件导入-修正
     * @param inputStream
     * @param isXls
     * @param sceneInstId
     * @param fileName
     * @param importType
     * @return
     */
    String updateBatchAcceptData(InputStream inputStream, boolean isXls, String sceneInstId, String fileName,
        String importType);

    /**
     * 批量受理录入-文件导入-覆盖
     * @param inputStream
     * @param isXls
     * @param sceneInstId
     * @param fileName
     * @param importType
     * @return
     */
    String converBatchAcceptData(InputStream inputStream, boolean isXls, String sceneInstId, String fileName,
        String importType);

    /**
     * 数据合规性校验
     * @param sceneInstId
     * @param batchId
     */
    void checkData(String sceneInstId, String batchId);

    /**
     * 根据批次号删除批次和详情
     * @param batchId
     */
    void deleteData(String batchId);

    /**
     * 根据批次号删除批次和详情
     * @param batchId
     */
    String deleteDetailData(String sceneInstId, String custId, String batchId, String detailId);

    /**
     * 删除实例
     * @param sceneInstId
     * @param custId
     * @param offerInstId
     * @return
     */
    boolean deleteOfferInstAndRelInsts(String sceneInstId, String custId, String offerInstId);

    /**
     * 查询详情列表
     * @param batchId
     * @param detailId
     * @return
     */
    List<KiteBatchAcceptDetail> listDetial(Map<String, Object> paramMap);


    PageInfo<KiteBatchAcceptDetail> listDetialForPage(Map<String, Object> paramMap);

    /**
     * 查询校验失败的明细
     * @param batchId
     * @param detailId
     * @return
     */
    List<KiteBatchAcceptDetail> listCheckFailDetail(String batchId);

    KiteBatchAccept getKiteBatchAccept(String batchId);

    KiteBatchAcceptDetail getBatchAcceptDetail(String detailId, String batchId);

    /**
     * 批量受理录入-导入文件列表
     * @param sceneInstId
     * @param offerInstId
     * @param custId
     * @return
     */
    List<BatchAccepImportFileVO> listImportFile(String sceneInstId, String offerInstId, String custId);

    /**
     * 批量受理录入-导入详情列表
     * @param sceneInstId
     * @param offerInstId
     * @param custId
     * @return
     */
    PageInfo<BusimportDetailVO> listImportDetails(String custId, String sceneInstId, String searchContent, Integer pageNum, Integer pageSize);

    void deleteImportFile(String sceneInstId, String fileType, String custId, String offerInstId);
}
